<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
	<title>三七物联管理平台</title>
	<link rel="stylesheet" type="text/css" href="/home/css/rude.css">
	<!-- <link href="favicon.ico" type="image/x-icon" rel="icon"> -->
	<link href="iTunesArtwork@2x.png" sizes="114x114" rel="apple-touch-icon-precomposed">
	<style type="text/css">
		body{
			background-color: white;
		}
    .btn-confirm{
      position:absolute;
      left:50%;
      margin-left:-87px;
    }
    .aui-btn-item{
              margin-top:10%;
              position:relative;
    }
	</style>

</head>
<body>
	  	<div class="aui-container">
	  		{{csrf_field()}}

		<div class="aui-page">
			<div class="header header-color">
				<div class="header-background"></div>
				<div class="toolbar statusbar-padding">
					<button class="bar-button back-button"  onclick="history.go(-1);"><i class="icon icon-back-sx"></i></button>
					<div class="header-title">
						<div class="title">修改密码</div>
					</div>
				</div>
			</div>
			<div class="aui-text-top aui-l-content aui-l-content-clear">
				<div class="devider b-line"></div>
				<div class="aui-menu-list aui-menu-list-clear">
				 <form   onsubmit="return fn()" >
                       {{csrf_field()}}
                      <ul>
                          <!-- <p id="err_msg"></p> -->
                         <li>
                          <i class="pw"><img src="/home/images//mm.png"></i>
                          <input class="pwd" type="password"  name="pwd" id="pwd" placeholder="请输入新密码" />
                           
                        </li>
                        <p id="err_msg" style="margin-left: 18%;font-size: 10px;color: red;"></p>
                        <hr style="border-bottom:1px solid #f5f5f5 ">
                          <li>
                            <i class="pw2"><img src="/home/images/mm.png"></i>
                            <input class="pwd2" type="password" name="pwd2" id="rpwd" placeholder="请确认新密码" />
                           
                          </li>
                            <p id="err_mg" style="margin-left: 18%;font-size: 10px;color: red;"></p>
                          <hr style="border-bottom:1px solid #f5f5f5 ">
                      </ul>
                        <div class="aui-btn-item" style="margin-top: 10%;">
				           {{--<a href="javascript:;" class="btn btn-confirm">提交</a>--}}
							<button class="btn btn-confirm" type="button" id="btn"> 提交</button>
			            </div>
                      </form>

				</div>

			</div>

		</div>
		 
	</div>

</body>
	 <script type="text/javascript" src="/home/js/jquery.js"></script>
<script type="text/javascript">
	// 修改密码表单验证
   var pwd = document.getElementById('pwd');
   var err_msg = document.getElementById('err_msg');
   pwd.onfocus = function () {
    err_msg.innerHTML = "*由6-24位数字/字母/符号组成";
    }
function psdfn() {
    if(pwd.value == ""){
        err_msg.innerHTML ="*密码不能为空";

        return false;
    }
    var regex4 = /^[\x21-\x7E]{6,24}$/;
    if(regex4.test(pwd.value) == true){
        // err_msg.innerHTML ='<img src="/pc/login/img/success.png" style="height:16px ;width:16px" />';

        return true;
    } else {
        err_msg.innerHTML = "*密码格式不对";

        return false;
    }
}
pwd.onblur = psdfn; 

// 密码确认
var rpwd = document.getElementById('rpwd');
var err_mg = document.getElementById('err_mg');
rpwd.onfocus = function(){
    err_mg.innerHTML = "*确认密码";
}
function rpsdfn() {
    if(rpwd.value == "") {
        err_mg.innerHTML = "*确认密码不能为空";

        return false;
    }
    if(rpwd.value == pwd.value) {
        // err_mg.innerHTML = '<img src="/pc/login/img/success.png" style="height:16px ;width:16px" />';
        return true;
    } else {
        err_mg.innerHTML = "*密码输入不一致";

        return false;
    }
}
rpwd.onblur = rpsdfn;

function fn() {

        var res3 = psdfn();
        var res4= rpsdfn();
       
    return res3 && res4 ;
}
 $('#btn').on('click', function(){
       var res3= psdfn()
       var res4= rpsdfn()
          if(res3 && res4  ){
                $.ajax({
                type: 'POST',
                url: "/home/mine/chan",
                data: $('form').serialize(),
                dataType: 'json',
                success: function(data){
					if(data.status ==1){
                 document.getElementById('ts').innerHTML = "*修改成功";
                 window.location.href="/home/homepage/index";
					}
                }
            });


          }
               
         
           
        })
</script>
</html>
  